package artifacts;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;

import cartago.Artifact;
import cartago.OPERATION;
import cartago.ObsProperty;
import cartago.OpFeedbackParam;

public class KITSpecificationArt {
    private String kitSpecification;
	
	@OPERATION public void init()  {
		this.readFile();
      }
	@OPERATION public void getSpecification(OpFeedbackParam<String> specification)  {
		specification.set(this.kitSpecification);
      }
	
	private void readFile(){
	    File file = null;
	    FileReader fr = null;
	    BufferedReader br = null;
	
	    try {
	       file = new File ("C:\\kitSpecification.xml");
	       fr = new FileReader (file);
	       br = new BufferedReader(fr);
	
	       // Lectura del fichero
	       String line;
	       while((line=br.readLine())!=null)
	    	   this.kitSpecification.concat(line);
	    }
	    catch(Exception e){
	       e.printStackTrace();
	    }finally{
	       try{                    
	          if( null != fr ){ fr.close(); }                  
	       }catch (Exception e2){ 
	          e2.printStackTrace();
	       }
	    }
	}
}
